function addGenerator (Blockly) {// this rule is the rule in openblock-gui/.../generator/..
    Blockly.Loongson.bh1750_getValue = function (block) {
        Blockly.Loongson.imports_["loongpio"] = 'from loongpio import *'
        Blockly.Loongson.imports_["loongpio.pins"] = "from loongpio.pins import *";
        const scl = this.getFieldValue('scl') || 'IIC0_SCL';
        const sda = block.getFieldValue('sda') || 'IIC0_SDA'; // or this.getFieldValue()
        // as the same,you can use the 
        // var level = Blockly.Loongson.valueToCode(block, 'LEVEL', Blockly.Loongson.ORDER_FUNCTION_CALL) || 'LOW';
        Blockly.Loongson.setups_[`_${scl}_${sda}`] = `_${scl}_${sda} = BH1750(${scl},${sda})`
        var code = `_${scl}_${sda}.lux`;
        return [code, Blockly.Loongson.ORDER_ATOMIC];
    };
    return Blockly;
}

exports = addGenerator;